var express = require('express');   //引入框架
var db = require('./db.js');
var route = express.Router();
var bodyParser = require('body-parser');
var urlencodedParser = bodyParser.urlencoded({ extended: false })

route.post('/register',urlencodedParser , function(req , res){
	let {loginName,loginKey, name,age,gender,edu,roles,introduction } = req.body
    var sql =  `insert into users  (loginName,loginKey, name,age,gender,edu,introduction) values  (?,?,?,?,?,?,?)`;
	db.doMysql(sql,[loginName,loginKey,name,age,gender,edu,introduction]).then(data=>{
		res.send({
			code:20000,
			message:'成功'
		})
	})
})

exports.route = route